package com.ifacebox.arcsoft.face;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.time.Duration;

/**
 * @author znn
 */
@Component
@ConfigurationProperties(prefix = "face.config")
public class ArcSoftFaceConfigProperties {
    private int faceMaxThreads = -1;
    private Duration faceMaxWait = Duration.ofSeconds(5);
    private float faceThreshold = 0.8f;
    private boolean supportLiveness = false;
    private float livenessRgbThreshold = 0.5f;
    private float livenessIrThreshold = 0.7f;
    private String appId;
    private String sdkKey;
    private String activeKey;
    private String libPath;

    public int getFaceMaxThreads() {
        return faceMaxThreads <= 0 ? Runtime.getRuntime().availableProcessors() : faceMaxThreads;
    }

    public void setFaceMaxThreads(int faceMaxThreads) {
        this.faceMaxThreads = faceMaxThreads;
    }

    public Duration getFaceMaxWait() {
        return faceMaxWait;
    }

    public void setFaceMaxWait(Duration faceMaxWait) {
        this.faceMaxWait = faceMaxWait;
    }

    public float getFaceThreshold() {
        return faceThreshold;
    }

    public void setFaceThreshold(float faceThreshold) {
        this.faceThreshold = faceThreshold;
    }

    public boolean isSupportLiveness() {
        return supportLiveness;
    }

    public void setSupportLiveness(boolean supportLiveness) {
        this.supportLiveness = supportLiveness;
    }

    public float getLivenessRgbThreshold() {
        return livenessRgbThreshold;
    }

    public void setLivenessRgbThreshold(float livenessRgbThreshold) {
        this.livenessRgbThreshold = livenessRgbThreshold;
    }

    public float getLivenessIrThreshold() {
        return livenessIrThreshold;
    }

    public void setLivenessIrThreshold(float livenessIrThreshold) {
        this.livenessIrThreshold = livenessIrThreshold;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getSdkKey() {
        return sdkKey;
    }

    public void setSdkKey(String sdkKey) {
        this.sdkKey = sdkKey;
    }

    public String getActiveKey() {
        return activeKey;
    }

    public void setActiveKey(String activeKey) {
        this.activeKey = activeKey;
    }

    public String getLibPath() {
        return libPath;
    }

    public void setLibPath(String libPath) {
        this.libPath = libPath;
    }
}
